package org.haq.bae.manager;

import org.haq.bae.runtime.core.Datasource;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * User: abilhakim
 * Date: 5/8/12
 * Time: 6:21 PM
 */
public final class DatasourceManager {

    private final Map<String, Datasource> datasourceMap = new LinkedHashMap<String, Datasource>();

    private static DatasourceManager __instance;

    private DatasourceManager() {

    }

    public static DatasourceManager getInstance() {
        if (__instance == null) {
            __instance = new DatasourceManager();
        }
        return __instance;
    }

    public Datasource getDatasource(String name) {
        return datasourceMap.get(name);
    }

    public void addDatasource(String name, Datasource datasource) {
        datasourceMap.put(name, datasource);
    }

}
